package com.msb.c05;

/**
 * @author: xw
 * @create: 2022/9/22 14:43
 * @description: 同步方法和非同步方法能否一起调用  可以
 */
public class T {

    public  synchronized void m1(){
        System.out.println("m1 start--");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("m1 end-------------");
    }

    public  void m2(){
        System.out.println("m2 start--");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("m2 end-------------");
    }

    public static void main(String[] args) {
        T t = new T();
		new Thread(()->t.m1(), "t1").start();
		new Thread(()->t.m2(), "t2").start();
    }
}
